import { FC, MouseEventHandler, PropsWithChildren } from 'react'
import './button.less'
type TButton = {
  type?: 'primary' | 'error' | 'info'
  size?: 'large' | 'small'
  text?: boolean
  onClick?: MouseEventHandler<HTMLDivElement>
}
const Button: FC<PropsWithChildren<TButton>> = ({ type = 'primary', size = 'small', text = false, children, onClick }) => {
  const textClassName = `btn-text-${type} btn-size-${size}`
  const className = `btn btn-type-${type} btn-size-${size}`
  return (
    <>
      {text ? (
        <div className={textClassName}>{children}</div>
      ) : (
        <div onClick={onClick} className={className}>
          {children}
        </div>
      )}
    </>
  )
}
export default Button
